home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / March 96 / Re Can't install event handler < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  2.4 KB  |  [TEXT/ttxt]

  1. Subject:     Re: Can't install event handlers
  2. Sent:        3/4/96 6:52 PM
  3. Received:    3/4/96 6:20 PM
  4. From:        Greg Friedman, friedman@cognosis.com
  5. Reply-To:    ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. Mark Lanett, a quality engineer on our team, came to me with a suspicion of
  9. what the problem might be. We looked into it, and can explain the behavior
  10. described.
  11.  
  12. The ODUtils project that ships with ODF is built with PowerPC alignment on.
  13. This has the effect of padding fields in structs to longword boundaries.
  14. SIHelper.cpp declares two structures that, when compiled using 68k
  15. alignment, are 10 bytes in size. When compiled using PPC alignment, these
  16. structures grow in size to 12 bytes. This causes a problem because of the
  17. following line that appears in the method SIHashTable::Initialize in the
  18. file SIHshTlb.cpp:
  19.  
  20. if ( valueSize > kMaxValueSize )
  21.      THROW( kODErrHashValueSizeTooBig );
  22.  
  23. kMaxValueSize is defined, in SIHshTbl.cpp as follows:
  24.  
  25. #define kMaxValueSize 10
  26.  
  27. Compiling with PPC alignment pushes the size of the value structures above
  28. 10 bytes, causing an exception to get thrown, and the tables are never
  29. created.
  30.  
  31. There is a chance that the 10 byte limitation is an historical relic and is
  32. no longer necessary. I'm not willing to suggest you remove it, though.  An
  33. alternative approach is to force the problem structures to be compiled
  34. using 68k alignment.  This involves bracketing the declarations of the two
  35. structs in SIHelper.cpp as follows:
  36.  
  37.  
  38. #if PRAGMA_ALIGN_SUPPORTED
  39. #pragma options align=mac68k
  40. #endif
  41.  
  42. struct SIGenericValue
  43. {
  44.         UniversalProcPtr        handler;
  45.         ODSLong                         refCon;
  46.         ODBoolean                       fromTypeIsDesc;
  47. };
  48.  
  49. #if PRAGMA_ALIGN_SUPPORTED
  50. #pragma options align=reset
  51. #endif
  52.  
  53. #if PRAGMA_ALIGN_SUPPORTED
  54. #pragma options align=mac68k
  55. #endif
  56.  
  57. struct SICoercionHandlerValue
  58. {
  59.         ODCoercionHandlerUPP    handler;
  60.         ODSLong                                 refCon;
  61.         ODBoolean                               fromTypeIsDesc;
  62. };
  63.  
  64. #if PRAGMA_ALIGN_SUPPORTED
  65. #pragma options align=reset
  66. #endif
  67.  
  68. I've made the above changes to the version of SIHelper.cpp that we will
  69. ship with ODF 1. I'm also filing a bug against OpenDoc.
  70.  
  71. gsf.
  72.  
  73.  
  74.  
  75. ___________________________________________________________
  76.   Greg Friedman                      ODF Engineering
  77. Apple Computer
  78.  
  79.